package com.eorchis.module.trainingclass.dao;

import java.util.List;
import java.util.Map;
import com.eorchis.core.basedao.dao.IDaoSupport;
import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.basedao.entity.impl.AbstractBaseEntity;
import com.eorchis.module.classuser.domain.DepartmentUserBean;
import com.eorchis.module.department.domain.Department;
import com.eorchis.module.department.domain.DepartmentTreeCondition;
import com.eorchis.module.department.ui.commond.DepartmentValidCommond;
import com.eorchis.module.trainingclass.domain.BaseAttachment;
import com.eorchis.module.trainingclass.domain.BaseUserBean;
import com.eorchis.module.trainingclass.domain.SyncTrainingClassQueryBean;
import com.eorchis.module.trainingclass.domain.TrainingClass;
import com.eorchis.module.trainingclass.domain.TrainingClassPartFieldUpdateBean;
import com.eorchis.module.trainingclass.domain.UserIdAndYear;
import com.eorchis.module.trainingclass.querybean.TrainingClassQueryBean;
import com.eorchis.module.trainingclass.ui.commond.TrainingClassQueryCommond;
import com.eorchis.module.trainingclass.ui.commond.TrainingClassValidCommond;
import com.eorchis.module.user.domain.User;

/**
 * Title: ITrainingClassDao<br>
 * Description: 培训班信息数据接口<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * 
 * @author Max
 * @createDate 2013-12-10
 * @version $Revision$
 */
public interface ITrainingClassDao extends IDaoSupport {

	/**
	 * 查询班级列表
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2013-12-11
	 */
	List<TrainingClassQueryBean> findTrainingClassList(TrainingClassQueryCommond commond) throws Exception;
	
	/**
	 * 查询班级列表
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2013-12-11
	 */
	List<TrainingClassQueryBean> findTrainingClassList2(TrainingClassQueryCommond commond) throws Exception;

	/**
	 * 查询班级列表
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2013-12-11
	 */
	List<TrainingClassQueryBean> findTrainingClassListSignUp(TrainingClassQueryCommond commond) throws Exception;
	
	/**
	 * 查询班级列表
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2013-12-11
	 */
	List<TrainingClassQueryBean> findTrainingClassListSignUp2(TrainingClassQueryCommond commond) throws Exception;

	//查询二级节点上的第一个一级节点 by RongSL 20170705
	public List<?> findAdminLevel(DepartmentTreeCondition condition) throws Exception;
	/**
	 * 查询班级列表
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2015-03-26
	 */
	List<TrainingClassQueryBean> findTrainingClassListFinish(TrainingClassQueryCommond commond) throws Exception;

	/**
	 * 查询班级列表(不分页)
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Xupp
	 * @date 2014-12-16
	 */
	List<TrainingClassQueryBean> findTrainingClassListNoPage(TrainingClassQueryCommond commond) throws Exception;

	/**
	 * 班级培训班更新（局部属性更新 ，更新条件暂只支持ids）
	 * 
	 * @param trainingClassPartFieldUpdateBean
	 * @throws Exception
	 * @author ZhaoQT
	 * @date 2013-12-17
	 */
	public void updateTrainingClassPartField(TrainingClassPartFieldUpdateBean trainingClassPartFieldUpdateBean, String classId) throws Exception;

	/**
	 * 在添加和修改的时候判断培训班名称是否一样
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2013-12-17
	 */
	boolean decideClassName(TrainingClassValidCommond commond) throws Exception;

	/**
	 * 单位级项目查询班级列表
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2013-12-11
	 */
	List<TrainingClassQueryBean> findTrainingClassListForUnitProject(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * 查询班级列表(区级项目报名列表)
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @date 2013-12-25
	 */
	List<TrainingClassQueryBean> findOrganizationTrainingClassList(TrainingClassQueryCommond commond) throws Exception;

	/**
	 * 查询单位上报市级项目审核
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @date 2014-1-7
	 */
	public List<TrainingClassQueryBean> findTrainingClassListForAuditDS(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * 向干教网同步数据查询培训项目列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @date 2014-1-9
	 */
	public List<SyncTrainingClassQueryBean> findTrainingClassListSyncToGJW(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * 更新班级表项目审核时间
	 * 
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2014-1-17
	 */
	public void updateAduitDate(String classId, String aduitDate) throws Exception;

	/**
	 * 根据用户id查询用户部门id
	 * 
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2014-4-12
	 */
	public List<DepartmentUserBean> getDepIdByUserId(String[] userId) throws Exception;

	/**
	 * 通过excle导入的班级用户，此方法别的地方不要调用
	 * 
	 * @throws Exception
	 * @author Max
	 * @createDate 2014-5-14
	 */
	public void addUserByExcel(TrainingClass trainingClass, List<String> userIDs) throws Exception;

	Map<String, String> getUserIDInfo() throws Exception;

	void addUserOnLineInfoByExcel(List<UserIdAndYear> doUserIDs) throws Exception;

	void addTrainingClassByExcel(TrainingClass trainingClass) throws Exception;

	String getTrainingNum(TrainingClassValidCommond vCommond) throws Exception;

	void updateStudyHour(Double hour, String classId) throws Exception;

	/**
	 * 单位报名班级列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @date 2015-1-5
	 */
	public List<TrainingClassQueryBean> findTrainingClassListByDept(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * 单位报名班级列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author GaoGQ
	 * @date 2015-1-5
	 */
	public List<TrainingClassQueryBean> findTrainingClassListByDeptFinish(TrainingClassQueryCommond queryCommond) throws Exception;

	void updateCState(String classId) throws Exception;

	public List<TrainingClassQueryBean> findUserSignupClassList(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * 查询单位培训班没有分页
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author ShenPS
	 * @date 2015年1月15日
	 */
	public List<TrainingClassQueryBean> findTrainingClassListByDeptNoPage(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * @category 构建班级查询对象
	 * @param queryCommond
	 * @param queryHql
	 * @return [0] hql String [1] params Map<String,Object>
	 * @throws Exception
	 */
	public Object[] buildQueryObject(TrainingClassQueryCommond queryCommond, StringBuffer queryHql) throws Exception;

	/**
	 * 单位管理员查询培训班列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 */
	List<TrainingClassQueryBean> queryTrainingClassList(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * 判断培训班编号是否一样
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @date 2016-1-15
	 */
	boolean decideClassNum(TrainingClassValidCommond commond) throws Exception;

	/**
	 * @category 查询班级的报名情况(委托部委办班在线报名系统)
	 * @param validCommond
	 * @throws Exception
	 * @author NingSS
	 * @return
	 */
	List<TrainingClassQueryBean> findClassUserAsignCount(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * @评估查询
	 * @Name: findClassAssessmentt
	 * @Description: @param qCommond
	 * @Description: @param request
	 * @Description: @param response
	 * @Description: @param resultState
	 * @Description: @return
	 * @Description: @throws Exception
	 * @Author: GUOLEI
	 * @Version: V1.00
	 * @Create Date: 2016-2-6下午12:23:22
	 * @Parameters: ITrainingClassService
	 * @Return: String
	 */

	public List<TrainingClassQueryBean> findClassAssessmentt(TrainingClassQueryCommond qCommond) throws Exception;

	/**
	 * @评估人员
	 * @Name: findAnswerUser
	 * @Description: @param queryCommond
	 * @Description: @throws Exception
	 * @Author: RongSL
	 * @Version: V1.00
	 * @Create Date: 2016-2-16
	 * @Return: List<BaseUser>
	 */

	public List<BaseUserBean> findAnswerUser(TrainingClassQueryCommond queryCommond) throws Exception;
	
	/**
	 * 查询已评估人员
	 * @createDate 2017-3-2
	 * @author RongSL
	 * */
	List<BaseUserBean> findAlreadyEvaluated(TrainingClassQueryCommond queryCommond) throws Exception ;
	
	/**
	 * @评估人员
	 * @Name: findAnswerUser
	 * @Description: @param queryCommond
	 * @Description: @throws Exception
	 * @Author: RongSL
	 * @Version: V1.00
	 * @Create Date: 2016-2-16
	 * @Return: List<BaseUser>
	 */
	
	public List<BaseUserBean> findAnswerUserExp(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * 更新评估时间
	 * 
	 * @param commond
	 * @throws Exception
	 * @author LongJZ
	 * @date 2016-4-18
	 */
	public void updateAssessTime(TrainingClassValidCommond commond) throws Exception;

	/**
	 * 新增附件
	 * 
	 * @param commond
	 * @throws Exception
	 * @author RongSL
	 * @date 2016-7-28
	 */
	public BaseAttachment saveBaseAttachment(BaseAttachment bd);

	/**
	 * 获得培训班考勤率
	 * 
	 * @author RongSL
	 * @Date 2016-09-17
	 * */
	public Map<String, Integer> getAttendanceChance(TrainingClassQueryCommond queryCommond);

	/**
	 * @课程评估查询
	 * @Name: findClassAssessmentt
	 * @Author: RongSL
	 * @CreateDate: 2016-5-20
	 * @Return: List<TrainingClassQueryBean>
	 */
	public List<TrainingClassQueryBean> findCourseAssessment(TrainingClassQueryCommond queryCommond) throws Exception;

	/**
	 * @评估人员
	 * @Name: findCourseAnswerUser
	 * @Description: @param queryCommond
	 * @Description: @throws Exception
	 * @Author: RongSL
	 * @Version: V1.00
	 * @Create Date: 2016-5-30
	 * @Return: List<BaseUser>
	 */
	public List<BaseUserBean> findCourseAnswerUser(TrainingClassQueryCommond queryCommond) throws Exception;
	
	/**
	 * 查询子部门
	 * */
	public List<Department> findDedepartmentList(DepartmentValidCommond validCommond)  throws Exception;
	
	/**
	 * 查询子部门全路径
	 * */
	public String findDepartmentNamePath(DepartmentValidCommond validCommond)  throws Exception;
	

	/**
	 * 获得培训班编号
	 * @author RongSL
	 * @date 2017-01-07
	 * */
	public String getTrainingClassNum();
	

	/**
	 * 保存实体bean
	 * @author RongSL
	 * @date 2017-01-08
	 * */
	public <T extends AbstractBaseEntity & IBaseEntity> void saveEntity(T view);
	
	/**
	 * 删除承办部委&指定报名机构
	 * @author RongSL
	 * @DATE 2017-01-08
	 * */
	public void deleteCBZD(TrainingClassValidCommond commond);
	
	/**
	 * 查询User
	 * */
	public User findByLoginID(String loginID);
	/**
	 * 查询培训班用户关系表
	 * @param tc
	 * @param user
	 * @return
	 */
	public boolean findClassUser(TrainingClass tc, User user);
	/**
	 * 保存培训班用户关系表
	 * @param tc
	 * @param user
	 * @return
	 */
	public boolean saveClassUser(TrainingClass tc, User user);

	/**
	 * 通过ClassId查询
	 * @param classId
	 * @return
	 */
	public TrainingClass findByClassId(String classId);
	
	/**
	 * 查询是否有报名权限
	 * @param deptId
	 * @param classNum
	 * @return
	 */
	public int findRoleForScope(String deptId, String classNum);
	
	/**
	 * 查询是否有被市委组织部选为承办部委
	 * @author RongSL
	 * @Date 2017-01-19
	 * */
	public int isGJCChoiceUndertake(String depId);

	/**
	 * 批量更新问卷评估方式
	 * @author RongSl
	 * @Date 2017-02-13
	 * */
	public void updateQuestionnaireMethod(TrainingClassQueryCommond queryCommond);
	public List<TrainingClassQueryBean> findClassNum(TrainingClassQueryCommond commond);
	/**
	 * 查询管理范围下有人的培训班
	 * @param commond
	 * @return
	 * @throws Exception
	 */
	public List<TrainingClassQueryBean> findAuditTrainingClassList(TrainingClassQueryCommond commond) throws Exception;
	
	/**
	 * 查询培训班(归档数据)
	 * @author RongSL
	 * 2017年12月22日
	 * */
	public TrainingClassValidCommond findTrainingPxarchives(TrainingClassValidCommond vCommond);
}
